package ar.com.gals.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@SequenceGenerator(
	name = "gals_id_sequence", 
	sequenceName = "marca_id_seq", 
	allocationSize = 1
)
@Table(name="marca")
public class Marca extends Gals {

	@Column(name="nombre", nullable = false)
	private String nombre;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(
		name = "marca_rubro", 
		joinColumns = { 
			@JoinColumn(name = "marca_id", referencedColumnName = "id", nullable = false, updatable = false) 
		}, 
		inverseJoinColumns = { 
			@JoinColumn(name = "rubro_id", referencedColumnName = "id", nullable = false, updatable = false) 
		}
	)
	private Set<Rubro> rubros = new HashSet<Rubro>();
	
	
	public String getNombre() {
		return nombre;
	}
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	public Set<Rubro> getRubros() {
		return rubros;
	}
	public void setRubros(Set<Rubro> rubros) {
		this.rubros = rubros;
	}
}
